<template>
  <basic-dialog
    width="60%"
    title="编辑日志查看"
    :visible="visible"
    :showFooter="false"
    :handleClose="handleCloseDialog"
  >
    <SkusTable
      showPagination
      :loading="TableInfo.loading"
      :columns="TableInfo.columns"
      :dataSource="TableInfo.list"
      :tableHeight="480"
      :pageSizes="pageSizes"
      :pagination="pagination"
      :total="total"
      @pageChange="handlePageChange"
      @pageSizeSelect="handlePageSizeChange"
    />
  </basic-dialog>
</template>
<script>
import BasicDialog from '@/components/BasicDialog';
import SkusTable from '@/components/skusTable';
import skusPage from '@/mixins/commodity/skusPage';
import { TableInfo } from '@/utils/getUtils';
export default {
  mixins: [skusPage],
  components: {
    BasicDialog,
    SkusTable
  },
  props: {
    visible: Boolean,
    skuNo: {
      type: String,
      required: true
    }
  },
  data () {
    return {
      TableInfo: new TableInfo({
        columns: [
          { title: '品类编码',  key: 'categoryNo' },
          { title: '订货金额',  key: 'createOpeTime' },
          { title: '订货频次',  key: 'skuNo' },
          { title: '提交人',  key: 'content' },
          { title: '提交时间',  key: 'content' },
        ]
      })
    }
  },
  watch: {
    visible (val) {
      val && this.getTableData()
    }
  },
  methods: {
    // 获取表格数据
    async getTableData () {
      const data = { skuNo: this.skuNo, ...this.paginationParams }
      const requestService = () => {}
      const res = await requestService(data, this.TableInfo.setLoading)
      this.TableInfo.setList(res.retData?.results ?? [])
      this.setTotalNum(res.retData?.totalNum ?? 0)
    },
    // 关闭弹框
    handleCloseDialog () {
      this.$emit('update:visible', false)
    },
  }
}
</script>
